(function(angular) {
	'use strict';
	angular.module('fs.waf').controller('cda.siteDate.viewController', viewController);
	viewController.$inject = [ '$q', '$scope', 'Constants', "modalService", 'layoutConfig', 'validatorConfig', 'gridService', 'authService', 'siteService' ];
	function viewController($q, $scope, Constants, modalService, layoutConfig, validatorConfig, gridService, authService, siteService) {
		var ctrl = this, siteInfo = $scope.$stateParams.params;
		ctrl.layoutConfig = layoutConfig;
		ctrl.authService = authService;
		ctrl.site = {};
		
		siteService.getCalendarCodes().then(function(response) {
			ctrl.calendarCodes = response.data;
		});
		
		ctrl.init = function() {
			authService.view(siteInfo).then(function(response) {
				if (response.data && response.data.model && response.data.task) {
					ctrl.site = response.data.model;
					ctrl.site.taskId = response.data.task.taskId;
				}
			});
		};

	}
})(angular);
